package com.kinghunt.misp.common;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

/**
 * 静态资源映射配置
 *
 * @author: jinping
 * @desc:
 * @date 2021/3/4
 * @modified by:
 */
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
    @Resource
    UploadFileConfig uploadFileConfig;

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/bookCover/*").
                addResourceLocations("file:" + uploadFileConfig.getBookCoverPath());

        registry.addResourceHandler("/bookList/*").
                addResourceLocations("file:" + uploadFileConfig.getBookListPath());
    }
}
